package cn.edu.ctbu.api01.helper;
import java.util.HashMap;
import java.util.Map;

public class R extends HashMap<String, Object> {
    private Map<String, Object> resultMap;
    public R(){
        put("code",1);
        put("msg","操作成功");
    }
    public static R error(){return error(-1,"操作失败");}
    public static R error(String msg){return error(-1,msg);}
    public static R error(int code,String msg){
        R r = new R();
        r.put("code",code);
        r.put("msg",msg);
        return r;
    }
    public static R ok(String msg){
        R r = new R();
        r.put("msg",msg);
        return r;
    }
    public static R ok(Map<String, Object> map){
        R r = new R();
        r.putAll(map);
        return r;
    }
}